package com.liuya.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.liuya.common.I18N;
import org.springframework.web.servlet.ModelAndView;

/**
 * 错误处理拦截器，己废弃，在BaseController中使用注解了
 * @Author 刘亚
 * @DATE 2017/1/6
 */
public class ErrorInterceptorHandler implements org.springframework.web.servlet.HandlerInterceptor{

    @Override
    public void afterCompletion(HttpServletRequest arg0,
                                HttpServletResponse arg1, Object arg2, Exception arg3)
            throws Exception {

    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object arg2, ModelAndView mv) throws Exception {
        String msgcode = request.getParameter("msgcode");
        if(msgcode!=null){
            mv.addObject("ation_message", I18N.getMessage(request.getParameter("msgcode")));
        }

    }
    @Override
    public boolean preHandle(HttpServletRequest arg0, HttpServletResponse arg1,
                             Object arg2) throws Exception {
        return true;
    }
}
